UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Heuvgzzl+XFdLZNFbTQKh6YRwj/s4bIoY9VWt49v3VM=' 
WHERE 
  key_id = 'dff6545d723b14f82d0174b3852a0568d88f58b1ca00242a58f28011132f9334' 
  AND (
    token = 'Heuvgzzl+XFdLZNFbTQKh6YRwj/s4bIoY9VWt49v3VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049