UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KR8DMBmEvlkaf81M+qqMbxjgyW151+S72YaO3MChic8=' 
WHERE 
  key_id = '8399f1bc6103a03d8d095d533e3c64af2880af8f98344add5f3335f9c589c28d' 
  AND (
    token = 'KR8DMBmEvlkaf81M+qqMbxjgyW151+S72YaO3MChic8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027