UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7g9NZV6Do5vdQZEacfGYBIjanRx6MFmtLe1woWlIQ9g=' 
WHERE 
  key_id = 'a3ba98c265f2b05f89f25ba63b64fc6382af5a2f040ea10dee48fe8be6cacc4e' 
  AND (
    token = '7g9NZV6Do5vdQZEacfGYBIjanRx6MFmtLe1woWlIQ9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045