UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jcP/Gtq1vhKi53iOMdGl6a3CWj/aw8ddPmN57Tr6p/c=' 
WHERE 
  key_id = '21052864bf1f265c756e35f4062a43d790d34689f92af24da516447b222686f3' 
  AND (
    token = 'jcP/Gtq1vhKi53iOMdGl6a3CWj/aw8ddPmN57Tr6p/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037