UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XeM6pk5xEc0U3Cel0u4HgX+h//10uHgLQGCcdR73mE8=' 
WHERE 
  key_id = '610c2ba527da3cce6b4ffd10978e3e255437a169128efea786885f197bd910a3' 
  AND (
    token = 'XeM6pk5xEc0U3Cel0u4HgX+h//10uHgLQGCcdR73mE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032