UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPHP6maLradO2asRgIptIZ8bOlBoXi/3p+xo6NR+0DY=' 
WHERE 
  key_id = '3e7ebd534c28a220c3c9c6cb93d8e05f21366d5d90e1982a99d1e2457e9f1928' 
  AND (
    token = 'DPHP6maLradO2asRgIptIZ8bOlBoXi/3p+xo6NR+0DY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034