UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Co+tRRKvhegyNFhr5cF4IT9i2pGD/KhIdoPEtEwnz+I=' 
WHERE 
  key_id = 'c9cb764aff151d262cd4c529f0cbb70baad5afe6ed8d01a5bf1288c8c8d5a571' 
  AND (
    token = 'Co+tRRKvhegyNFhr5cF4IT9i2pGD/KhIdoPEtEwnz+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044