UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a380mxQjgLR2dolDs1PXOpjWzKnhjiOLXZkc87HrDV4=' 
WHERE 
  key_id = 'ffe823072c73dbc32b01bc2b4545af220ff8198076aa4d9fd122bbf375545569' 
  AND (
    token = 'a380mxQjgLR2dolDs1PXOpjWzKnhjiOLXZkc87HrDV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031