UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UcFt/jFVcLkAg+nEafxhmJqDLaHBN3GvzgG3vLN3hPM=' 
WHERE 
  key_id = '07516acd1530452291baf23b79bfdeb04c4a7173e926a9a16519d14118350352' 
  AND (
    token = 'UcFt/jFVcLkAg+nEafxhmJqDLaHBN3GvzgG3vLN3hPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027