UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k84bauZKbMXILCq1JM1JjnXptM0afJYP8UU/wyOhjIo=' 
WHERE 
  key_id = '8e65f8b6b86470ddfda9cee8a20bd1df270f11f33a1036cef2805d4f41ff09ca' 
  AND (
    token = 'k84bauZKbMXILCq1JM1JjnXptM0afJYP8UU/wyOhjIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024