UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QMIvHG9nQBt2zEvlxi84kcW5B849DGzHUuF1AYoriaU=' 
WHERE 
  key_id = '20a7678596b7af5a2d42ab7029bd2053abeeec64f9387790623162a04619bd84' 
  AND (
    token = 'QMIvHG9nQBt2zEvlxi84kcW5B849DGzHUuF1AYoriaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044