UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kdZxXIx6NWxQj0DqX8bwLtudw4DLT1hLl+cDXf5FuTo=' 
WHERE 
  key_id = '9420516d2a5aa3a98a8d135d46cc4c6e9c5f9564eb2b78eb0294a870c4892481' 
  AND (
    token = 'kdZxXIx6NWxQj0DqX8bwLtudw4DLT1hLl+cDXf5FuTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033