UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AycsY+1P+ONrXycqy8QRQ8dBIFAX3lcj1YHjVcVYyrg=' 
WHERE 
  key_id = 'defa39117ae18e7b98717ee3d914015177d6601eaba6af054fb1560bd217df94' 
  AND (
    token = 'AycsY+1P+ONrXycqy8QRQ8dBIFAX3lcj1YHjVcVYyrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036