UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PZsUqY3MxR1nM4rhOvdYLnzXTfkxevQx8BwjVmvOxuA=' 
WHERE 
  key_id = '2cb8ad3970833ef7d1fe18582095e5571918b6e290c6cf5b45bb1c0aa4023887' 
  AND (
    token = 'PZsUqY3MxR1nM4rhOvdYLnzXTfkxevQx8BwjVmvOxuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027