UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ttfJs3QQRoxZwTbV8McnSCCN1v4e6HYbiwukkDOq6ow=' 
WHERE 
  key_id = '469bf95545c220ca85acdeb01f86979760a761a9b0a4e5597b1da027f7834c2e' 
  AND (
    token = 'ttfJs3QQRoxZwTbV8McnSCCN1v4e6HYbiwukkDOq6ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032