UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FMLkXe9wdTeoixjCufZ+RXB1FAubxMHIQSjFeOZrDMY=' 
WHERE 
  key_id = '39b6bc68c543c42c64038e9d717e1c30780907a33bb9103bc4bdcca86d4874f1' 
  AND (
    token = 'FMLkXe9wdTeoixjCufZ+RXB1FAubxMHIQSjFeOZrDMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053