UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NAT7w5tUNAUr6W8T7HVyynbDk6P6M8YEl/G+AeY3/4=' 
WHERE 
  key_id = '8e99f801974bfed63bd1855f7723cc1593dea1dd30cabe94a9060dcbb26861c1' 
  AND (
    token = '3NAT7w5tUNAUr6W8T7HVyynbDk6P6M8YEl/G+AeY3/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031