UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0Nh+T1bjmHpv6V3RAQAO5VtiO+4y2kxpFJAdw1RX2s=' 
WHERE 
  key_id = '12de9fe7c0e97c58c49f59e10bb4a17de7c889d480fbe7ab2935128d4f397064' 
  AND (
    token = 'l0Nh+T1bjmHpv6V3RAQAO5VtiO+4y2kxpFJAdw1RX2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033