UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dv4ADfKFTYs/diYkCtJbP14Z0zCNkpV3xD19tPTj4Sk=' 
WHERE 
  key_id = '08381b7ffe3943128eada08bcd183920e7044398d320a2c5321fb793162b3e70' 
  AND (
    token = 'Dv4ADfKFTYs/diYkCtJbP14Z0zCNkpV3xD19tPTj4Sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00185