UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+dpU0OGACCbz6U/kSVk9YjNeYYBM0EGKqKfx7U/msf8=' 
WHERE 
  key_id = '96c81974b704ba41fe08d617d17342345b96972e187c7e1d379558b95a25f3b6' 
  AND (
    token = '+dpU0OGACCbz6U/kSVk9YjNeYYBM0EGKqKfx7U/msf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059