UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'upGb51B3cA1dpI0QQE5rkKbqcLo/5oIOkdqpA+qYVHk=' 
WHERE 
  key_id = '11483828b55a00522d96757367fe3d1d0e7895a0ec47c2c953b48b4ee457a45e' 
  AND (
    token = 'upGb51B3cA1dpI0QQE5rkKbqcLo/5oIOkdqpA+qYVHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040