UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9p7jQSh27np5efTNwZzxfUQ9D+IefoftvXb2JF8Nj2g=' 
WHERE 
  key_id = 'd9cc587d3deee3df543e766b5b2a7d5893a6c0f381a5090ff32b8c05196a6f1c' 
  AND (
    token = '9p7jQSh27np5efTNwZzxfUQ9D+IefoftvXb2JF8Nj2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035