UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2of0meQJ4ep9L3zcmgktbk2+BovhJ085jsg2+hhwQes=' 
WHERE 
  key_id = 'f6721da0ca292cc85ee7b2019f266689efdeddffb32efb9f2e4115481ebe7a0f' 
  AND (
    token = '2of0meQJ4ep9L3zcmgktbk2+BovhJ085jsg2+hhwQes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071