UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uJlwODVKYTb78Q2TaMeRY3djtKWW2HmQsvQGP+/TSRI=' 
WHERE 
  key_id = '0ebb31bbe395354ce254b15242f69201f508feb1f9714917181b54d0acca3564' 
  AND (
    token = 'uJlwODVKYTb78Q2TaMeRY3djtKWW2HmQsvQGP+/TSRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040