UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtlMJe9Lwkm6Ex0Xv2T4Xnc3mKzmEh/qJeDB6mkhFcI=' 
WHERE 
  key_id = '6f61315527aef69fb5e20d8ed460cae4ab514452e79ce3f02b5d218b82b57138' 
  AND (
    token = 'NtlMJe9Lwkm6Ex0Xv2T4Xnc3mKzmEh/qJeDB6mkhFcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043