UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dw4cSVGsh6edp/ojVG+r7LSfpK0zHn77SUwSU+CKnkg=' 
WHERE 
  key_id = '3dcf8a3dfec78561be43e4c2de449882efd1c99db845ddca610f39ea8b80357e' 
  AND (
    token = 'dw4cSVGsh6edp/ojVG+r7LSfpK0zHn77SUwSU+CKnkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043