UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mv5peXU57+DG0smcYc92GeNj9EqydUcwYDdb/z+D6bo=' 
WHERE 
  key_id = '8b64c50297aef0f9c49b5cf1bcfed9160f3ab622130adb3a9144b38e8c001a01' 
  AND (
    token = 'mv5peXU57+DG0smcYc92GeNj9EqydUcwYDdb/z+D6bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032