UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYnlpusO44/dKBlU7g0VML5HWQHM4exUhHjV1niZNIY=' 
WHERE 
  key_id = '1263bf22a56c09f4f6f93f81395ef1fb4e7e1e10bf002273e62573d3daf19558' 
  AND (
    token = 'DYnlpusO44/dKBlU7g0VML5HWQHM4exUhHjV1niZNIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032