UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N7SZUASlFQtZne8/ZHixrYXysXl13gbtof3xo3CQ+xs=' 
WHERE 
  key_id = '5415a9d65004e09456eccdf0c95e0b8aed3b6cd2c811909ac6de8b8905fa7f6b' 
  AND (
    token = 'N7SZUASlFQtZne8/ZHixrYXysXl13gbtof3xo3CQ+xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035