UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lbkaiXoxE3mBXApiinOlV/a+wqYdE341Gi/GoAlBybM=' 
WHERE 
  key_id = '71f7d75d3af7dac285cd1a21c4a52632ebc97739ac02a55209b97c9ced7010b4' 
  AND (
    token = 'lbkaiXoxE3mBXApiinOlV/a+wqYdE341Gi/GoAlBybM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026