UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+JGymYap1U6a9uVYhb8dUWKD0xv8U/3dWj9iPYlWhk=' 
WHERE 
  key_id = '7ef93973a384ebe988408e0be9c434b154212c28101c14a303be7c181d519eec' 
  AND (
    token = 'g+JGymYap1U6a9uVYhb8dUWKD0xv8U/3dWj9iPYlWhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045