UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLdt6YiUAJgVp5tej5tyZ3TuUsqq52+9WV6OHjDCBW8=' 
WHERE 
  key_id = '655d1d66d372eeb4dce5bb5ae304d107f96ed9b740a259c5224bf078a40670af' 
  AND (
    token = 'HLdt6YiUAJgVp5tej5tyZ3TuUsqq52+9WV6OHjDCBW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046