UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kcvf7RmpuCEHx3NSsbXPnHg5BooyU8SnK+k2gfrMXtg=' 
WHERE 
  key_id = '76a00920d95c3b2d9a640b120fdeda18cde488f9fccb26795a54775139e6f644' 
  AND (
    token = 'Kcvf7RmpuCEHx3NSsbXPnHg5BooyU8SnK+k2gfrMXtg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049