UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nktIew17hQN/QVn67uh9ijAvyfRo6NxzjcHuDlvr1aM=' 
WHERE 
  key_id = 'f04670c05eee6fcb91345e6c40c6e6e153bd6948a356dfeb3928275f8c43769d' 
  AND (
    token = 'nktIew17hQN/QVn67uh9ijAvyfRo6NxzjcHuDlvr1aM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044