UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vAAC7UABCNIBg+aav5/hC2TmpZi+K60R+Nx1Thso5IM=' 
WHERE 
  key_id = '9330ed5dab063c596ce1dff0c9d8b00bd27a88f6066b2d1525b156842cd2b8cf' 
  AND (
    token = 'vAAC7UABCNIBg+aav5/hC2TmpZi+K60R+Nx1Thso5IM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028