UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DUJwpLNWwFasQxgv2mdvKFYGCaGHp1NMphWnQ+7Qaq4=' 
WHERE 
  key_id = 'b1e7a87bac2a798350c30a5b1360708a10d2fb3757aea6421c21543311879052' 
  AND (
    token = 'DUJwpLNWwFasQxgv2mdvKFYGCaGHp1NMphWnQ+7Qaq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042