UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2GhNNQZfroJp5xvN1C9qu5HOVVcpmIhGDWzu5M5kuQ=' 
WHERE 
  key_id = '8bbee3dd5873fdd91554c5055da75e97532444bde6448f7640d1ca3a71180ce0' 
  AND (
    token = 'n2GhNNQZfroJp5xvN1C9qu5HOVVcpmIhGDWzu5M5kuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049