UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXVGTWJ2dviMmdOHxRCiuoT7rIOF6c0xj2HjLmXI8bc=' 
WHERE 
  key_id = 'a852a024e1786c727e71d5a856b6fa00f78c16ad47ada91cf84f053e70bb46cb' 
  AND (
    token = 'RXVGTWJ2dviMmdOHxRCiuoT7rIOF6c0xj2HjLmXI8bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033