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

Query time 0.00052