UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w7K4Jc4DtFzqBZh20sRBwP3MGNIGO3DgAYbYk9+S2Vo=' 
WHERE 
  key_id = 'a2c5c398e90f70e8217a4d51d127caac03c725276bd4e164c8649da47718b043' 
  AND (
    token = 'w7K4Jc4DtFzqBZh20sRBwP3MGNIGO3DgAYbYk9+S2Vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046