UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gsVHg3sidsCaxLiVYkDm8xUvAq5tJ19gscKwgnG8w6Q=' 
WHERE 
  key_id = '20a56aef2b8c20b39fd984c3d5073580c450362d32048936ebcf9bc75e165183' 
  AND (
    token = 'gsVHg3sidsCaxLiVYkDm8xUvAq5tJ19gscKwgnG8w6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034