UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mdWGzML665d9sfVE4qyl7p1R5divWqrF1ezw+WmQvnY=' 
WHERE 
  key_id = '2412f74ceec41845740aa084935d14c29604455c4c0954a1a34ca981a3eb1a4a' 
  AND (
    token = 'mdWGzML665d9sfVE4qyl7p1R5divWqrF1ezw+WmQvnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028