UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P52conJZyM8vM01rvM6UXzQ5x8CniD69zi1jSY69sdg=' 
WHERE 
  key_id = 'aff5f2f0e993a3679d0e151d822df99b686ce4f8f72839c4df70aee7e3245870' 
  AND (
    token = 'P52conJZyM8vM01rvM6UXzQ5x8CniD69zi1jSY69sdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048