UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9w2doBnOYIfK/y4/5KDk+xJTXBGI79bn+i7D1DHisyc=' 
WHERE 
  key_id = 'b4894a343221cdf29fd8178a9c27088fb2ec9029db933b8909199e8558b2b02a' 
  AND (
    token = '9w2doBnOYIfK/y4/5KDk+xJTXBGI79bn+i7D1DHisyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047