UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xdcAoR0vxq6CR15Sg4P2xdkPYGG+7O45I1l8eo9o0Qc=' 
WHERE 
  key_id = '4d23d9c251afa9200ab2d1cc12d773a79aac736440ff1903d520e53c637ba68a' 
  AND (
    token = 'xdcAoR0vxq6CR15Sg4P2xdkPYGG+7O45I1l8eo9o0Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020