UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0Ur1juWQNNjnJNXYF2FLagPhJYH26/n25bt5WGZGnM=' 
WHERE 
  key_id = '9263c1da3324039b404e043d1f7d5c515941e5b97d8af00a1ff213db69a4227b' 
  AND (
    token = 'l0Ur1juWQNNjnJNXYF2FLagPhJYH26/n25bt5WGZGnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043