UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bXeCSn67kRcUxqPRGMjagob6LbGZ4eBA7GNu4DR0j38=' 
WHERE 
  key_id = '4c4150c026355ca4254660f389a095f7a820bd8da240661d0ce0be7d712c88a2' 
  AND (
    token = 'bXeCSn67kRcUxqPRGMjagob6LbGZ4eBA7GNu4DR0j38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036