UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8E2+IbMjofUgSltnb9+vGIB0hErvy1i78r3R6UyO3GM=' 
WHERE 
  key_id = '620de168d4b1896483542eb3c64cb726531cf18bf7133c733e83cee0a8723bd4' 
  AND (
    token = '8E2+IbMjofUgSltnb9+vGIB0hErvy1i78r3R6UyO3GM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047