UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSULud/N1Ng62ADidm1LBRicIEc+MEBRCZ7/alnrrdw=' 
WHERE 
  key_id = '8c87b00ae7c14ef46e6f1bb251b2302424eab2b406c163f3176e1df895bb174b' 
  AND (
    token = 'QSULud/N1Ng62ADidm1LBRicIEc+MEBRCZ7/alnrrdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034