UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z4JSPkuEjmc2upEh6IHwyf/Rk/GQXrnXV/Xhf1oyQVs=' 
WHERE 
  key_id = 'a5c3a01f70a2ca837351109ada164751064826a71ee9a791e50a610bfdb7df8d' 
  AND (
    token = 'Z4JSPkuEjmc2upEh6IHwyf/Rk/GQXrnXV/Xhf1oyQVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036