UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dTimoax7FKRwjBv6X7tFVP29VNrP1D//QMO1fzGVbmM=' 
WHERE 
  key_id = '51a1151e8e99d83b94af89694c6816d514e09453e21148c6ef26ab0b84a6e0d2' 
  AND (
    token = 'dTimoax7FKRwjBv6X7tFVP29VNrP1D//QMO1fzGVbmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030