UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwkcED2nW64FhhEUelX3WRXB15yXeugFG5sW17+LUQQ=' 
WHERE 
  key_id = '2126ef271253fc2a6f8867df8485230605d3573369a3c38418f83d6aa7b91969' 
  AND (
    token = 'iwkcED2nW64FhhEUelX3WRXB15yXeugFG5sW17+LUQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038