UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z3Vred3YHEUGN/7BcDk1AQx+vXZfWONbs+0a4a4l1Io=' 
WHERE 
  key_id = '4617af6abe0dc09c44cc9ac38acdc9446d4ac925df804bc818746fce078ecffd' 
  AND (
    token = 'Z3Vred3YHEUGN/7BcDk1AQx+vXZfWONbs+0a4a4l1Io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034